home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 18 / CU Amiga Magazine's Super CD-ROM 18 (1997)(EMAP Images)(GB)[!][issue 1998-01].iso / CUCD / Online / hsc / docs-source / project / make.hsc < prev    next >
Encoding:
Text File  |  1997-10-19  |  5.5 KB  |  134 lines

  1. <WEBPAGE chapter="hsc - Project Management - " title="Make"
  2.     BACK="index.html"
  3.     PREV="hscpitt.html"
  4.     NEXT="makefile.html">
  5.  
  6. <P>This chapter shortly describes a popular, but nearly unusable tool
  7. called <make>, which can be used to solve project management tasks
  8. when using <hsc>. This is not the only tool which is able to do so,
  9. but it should exist on most platforms.</P>
  10.  
  11. <H2>What is Make?</H2>
  12.  
  13. Let's start with a quote from the documentation to <EXEC>GNUmake</EXEC>:
  14.  
  15. <BLOCKQUOTE> <P>The `make' utility automatically determines which
  16. pieces of a large program need to be recompiled, and issues commands
  17. to recompile them. [...]</P>
  18.  
  19. <P>You can use `make' with any programming language whose compiler can
  20. be run with a shell command. Indeed, `make' is not limited to
  21. programs. You can use it to describe any task where some files must be
  22. updated automatically from others whenever the others change.
  23. [...]</P>
  24.  
  25. <P>To prepare to use `make', you must write a file called the
  26. "makefile" that describes the relationships among files in your program
  27. and provides commands for updating each file.</P>
  28. </BLOCKQUOTE>
  29.  
  30. <P>As of it's general purpose design, <make> also fits to be used
  31. in combination with <hsc>. So far for the good part.</P>
  32.  
  33. <H2>Which Make to Use</H2>
  34.  
  35. <P>One of the worst things about <make> is that - as far as I know -
  36. it comes from the fossil Unix world, with the usual results. There are
  37. several programs with the same name, but different features.
  38. Furthermore, you will have to bother with many occurrences of cryptic
  39. looking characters.</P>
  40.  
  41. <P>This documentation will always refer to a version of make commonly
  42. known as <EXEC>GNUmake</EXEC>, as it is freely distributable, exists
  43. as source code and has been ported to most platforms.</P>
  44.  
  45. <P>(For Amigoids: A tool called <EXEC>smake</EXEC> has become very
  46. popular under this system. Not because it is so powerful - on the
  47. contrary - but because it was shipped with the SAS/c package. You can
  48. put away this tool for <hsc>, probably not a single example given
  49. within this manual or the supporting material will work.)</P>
  50.  
  51. <H2>Why Make Sucks</H2>
  52.  
  53. <P>One thing nearly all <make>-tools have in common is the inability to
  54. produce useful error messages - if any at all.</P>
  55.  
  56. <P>Most of them are very picky about blanks and tabs (which can be
  57. created by pressing the <KBD>TAB</KBD> key). Tabs in plain text file
  58. are one of the most brain-damaged concept the (so called) modern
  59. computer industry has established. Of course it is easy for a machine
  60. to distinguish between spaces and tabs by their ASCII code. But the
  61. user will see a blank space on the screen in both cases.</P>
  62.  
  63. <P>This becomes even worse, as many editor applications do not care
  64. about tabs and replace them by spaces, normally without notifying the
  65. user about that. This can not only be annoying, as these editors in
  66. most cases are not sure if they should replace a tab by four or eight
  67. space characters, often resulting in an unexpected looking display.
  68. Even worse, picky tools (like most <make> tools) will interpret the
  69. <makefile> as trashed. So make sure you are using a decent editor. For
  70. example, <EXEC>memacs</EXEC> coming with the standard Workbench does a
  71. good job on this.</P>
  72.  
  73. <H2>Makefiles and Pattern Rules</H2>
  74.  
  75. <P>As already mentioned above, you will have to write a so called
  76. <Makefile>. This is by far the funniest part of <make> (apart from
  77. interpreting esoteric error messages). Basically, you have to specify
  78. rules how a target depending on specifics source is created. For
  79. <hsc>, the target is usually the html document, and the sources are
  80. all those files with the <KBD>.hsc</KBD> extension needed to create
  81. the document.</P>
  82.  
  83. <P>As it would be dull to tell <make> exactly what to do for every
  84. single target, you can specify so called pattern rules, which tell
  85. <make> how to generally handle whole groups of files.</P>
  86.  
  87. <P>Ancient versions of <make> often only support a rather impotent way
  88. for such pattern rules. An example of such an outdated rule:</P>
  89.  
  90. <$source PRE>
  91. .c.o:
  92.     $(CC) $(CFLAGS) -c $<
  93. </$source>
  94.  
  95. <P>The first line tells <make> that now a rule will follow how to
  96. create a target with a <qqc>.o</qqc> extension from a file with a
  97. <qqc>.c</qqc> extension. You shouldn't bother too much about the
  98. second line. The only thing you will have to know: You can forget
  99. these kind of rules for <hsc>. They did a good job for the ridiculous
  100. bunch of C-programmers and their ridiculous compilers, but they are
  101. useless for everything more sophisticated. However, many <make>-tools
  102. still only support such rules.</P>
  103.  
  104. The equivalent pattern rule in a more reasonable syntax look like
  105. this:
  106.  
  107. <$source PRE>
  108. %.o : %.c
  109.     $(CC) $(CFLAGS) -c $<
  110. </$source>
  111.  
  112. <P>This should give you a clue which sections of the manual of <make>
  113. should be relevant for you. Within the next chapter, you will find
  114. some remarks about how to write a <makefile> for <hsc>, but there
  115. probably still will be no way around at least giving a glimpse to the
  116. manual of <make>.</P>
  117.  
  118. <H2>So Why Make?</H2>
  119.  
  120. <P>After reading the above, one might think no one uses <make> as long
  121. there any alternative left. See, and there is the problem: If you want
  122. to have something quite powerful and flexible, which is available for
  123. most platforms and is freeware, there currently is no alternative.</P>
  124.  
  125. <P>If you know of any, tell me and I will kick the whole chapter about
  126. <make> and <Makefile>s immediately.</P>
  127.  
  128. <H2>Where to Get Make</H2>
  129.  
  130. <P>See also the section about <ln_related> where to obtain the version
  131. of <make> recommended for use with <hsc>.</P>
  132.  
  133. </WEBPAGE>
  134.